package com.tuyenmonkey.samples;

import com.tuyenmonkey.samples.utils.Util;

import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;

import org.junit.Assert;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * 单元测试工具类
 */
public class ExampleOhosTest {
    /**
     * 测试工具类初始化
     */
    @Test
    public void testBundleName() {
        final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
        assertEquals("com.tuyenmonkey.samples", actualBundleName);
    }

    /**
     * 测试工具类判空
     */
    @Test
    public void testUtilsIsEmpty() {
        boolean isEmpty = Util.isEmpty("123");
        Assert.assertNotNull(isEmpty);
        assertEquals(false, isEmpty);
    }

    /**
     * 测试工具类判空
     */
    @Test
    public void testUtilsIsEmpty2() {
        String str = null;
        boolean isEmpty = Util.isEmpty(str);
        Assert.assertNotNull(isEmpty);
        assertEquals(true, isEmpty);
    }

    /**
     * 测试工具类判空
     */
    @Test
    public void testUtilsIsEmpty3() {
        String str = "";
        boolean isEmpty = Util.isEmpty(str);
        Assert.assertNotNull(isEmpty);
        assertEquals(true, isEmpty);
    }

    /**
     * 测试工具类判空
     */
    @Test
    public void testUtilsIsNotEmpty() {
        String str = "";
        boolean isEmpty = Util.isNotEmpty(str);
        Assert.assertNotNull(isEmpty);
        assertEquals(false, isEmpty);
    }
}